<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="en-US">

<head>
    <meta charset="UTF-8">
    <title>ueditor demo</title>
</head>

<body>
<!-- 加载编辑器的容器 -->
<script id="container" name="content" type="text/plain">

</script>

<!-- 配置文件 -->
<script type="text/javascript" src="${basePath}/public/js/jquery.min.js"></script>
<script type="text/javascript" src="${basePath}/public/js/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="${basePath}/public/js/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container');
    //对编辑器的操作最好在编辑器ready之后再做
    ue.ready(function() {
        //获取html内容，返回: <p>hello</p>
        var html = ue.getContent();
    });

    function test() {
        var html = ue.getContent();
        var id = $("#id").val();
        alert(html)
        alert(id)
        $.ajax({
            url:"${basePath}/admin/work/description",
            type:"post",
            data:{
                id:id,
                description:html,
            },
            success:function (resultJson) {
                if (resultJson.status==1){
                    window.location.href="${basePath}/admin/adminUser/work/index";
                } else {
                    alert(resultJson.msg);
                }
            }
        })
    }
</script>

<c:forEach items="${list}" var="m">
    <input type="hidden" id="id" value="${m.id}">
</c:forEach>
</body>
<input type="button" value="保存" onclick="test()" >
</html>